#include <iostream>
#include <map>
using namespace std;

// 已知
int n;
// 未知
map<int, pair<int, int>> m;

int main()
{
    cin >> n;
    for (int i = 0, x; i < n; ++i)
    {
        cin >> x;
        m[x].first++;
        m[x].second = i;
    }
    for (auto it = m.rbegin(); it != m.rend(); ++it)
    {
        if (it->second.first == 1)
        {
            cout << it->second.second + 1 << endl;
            return 0;
        }
    }
    cout << -1;
    return 0;
}